home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / SASC_6.0_Disk_7.adf / Source_And_Examples / source / autoopenfail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-30  |  934 b   |  45 lines

  1. #include <proto/dos.h>
  2. #include <proto/exec.h>
  3. #include <string.h>
  4.  
  5. extern struct WBStartup *_WBenchMsg;
  6. extern char __stdiowin[];
  7. extern long __oslibversion;
  8. void _XCEXIT(int);
  9.  
  10. void __autoopenfail(char *lib)
  11. {
  12.    struct DOSBase *DOSBase;
  13.    long fh;
  14.    char numbers[4];
  15.    int temp;
  16.    
  17.    DOSBase = (struct DOSBase *)OpenLibrary("dos.library",0);
  18.    if (_WBenchMsg)
  19.       fh = Open(__stdiowin, MODE_NEWFILE);
  20.    else 
  21.       fh = Output();
  22.    
  23.    Write(fh, "Can't open version ", 20);
  24.    temp = __oslibversion;
  25.    numbers[0] = temp >= 100 ? '0' + temp/100 : ' ';
  26.    temp = temp % 100;
  27.    numbers[1] = temp >= 10 ?  '0' + temp/10  : ' ';
  28.    temp = temp % 10;
  29.    numbers[2] = '0' + temp;
  30.  
  31.    Write(fh, numbers, 3);
  32.    Write(fh, " of \"", 5);
  33.    Write(fh, lib, strlen(lib));
  34.    Write(fh, "\"\n",2);
  35.    
  36.    if (_WBenchMsg)
  37.    {
  38.       Delay(200);
  39.       Close(fh);
  40.    }   
  41.    
  42.    CloseLibrary((struct Library *)DOSBase);
  43.   _XCEXIT(20);
  44. }
  45.